package com.neuedu.javase.array;

/**
 * @author :金山老师
 * project: MyJavaSE
 * 描述 ： 多维数组   == 二维
 * @date : 2025/10/22 15:36 星期三
 */
public class MutlDimension {


    public static void main(String[] args) {


        //二维数组的初始化   二维数组的长度 可以不对齐
        String names[][] = {

                {"张三1", "李四1", "王五1"},
                {"张三2", "李四2", "王五2"},
                {"张三3", "李四3", "王五3"},
                {"张三4", "李四4", "王五4"},
                {"张三5", "李四5", "王五5","赵六"},
                {"张三6", "李四6", "王五6"},

        };


        System.out.println("names.length = " + names.length);  //6

        // String ns0[] = names[0];;
        // for (int i = 0; i < ns0.length; i++) {
        //     System.out.println(ns0[i]);
        // }
        //


        // for (int i = 0; i <  names.length; i++) {
        //     String ns0[] = names[i];;
        //     for (int j = 0; j < ns0.length; j++) {
        //         System.out.print(ns0[j]+"\t");
        //     }
        //     System.out.println();
        // }


        //变形
        for (int i = 0; i <  names.length; i++) {
            for (int j = 0; j < names[i].length; j++) {
                System.out.print(names[i][j]+"\t");
            }
            System.out.println();
        }




        //第二维 固定
        // String   className[][] = new String[5][6];
        String   className[][] = new String[5][3];

        // className[0]    = new String[2];
        // className[1]    = new String[5];
        // className[2]    = new String[10];
        // className[3]    = new String[20];
        // className[4]    = new String[3];



        className[3][2] = "32";

        System.out.println();




    }


}
